#include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,L,a[N],b[N],ta;
signed main(){
    freopen("lock.in","r",stdin);
    freopen("lock.out","w",stdout);
    cin>>n>>L;
    for(int i=1;i<=n;i++) cin>>a[i]>>b[i];
    for(int i=0;i<=(1<<n)-1;i++){
        int sum=0,ans=0;
        for(int j=1;j<=n;j++){
            if(i&(1<<(j-1))) sum^=a[j],ans^=b[j];
        }
        if(sum<=L) ta=max(ta,ans);
    }
    cout<<ta;
    return 0;
}